(function($) {
	
	$.fn.QuestionnairesModel = function() {
		
		that = this;
		
		var oQuestionnaire;
		var oQuestionBlock;
		var iQuestionBlockCount;
		
		/**
	     * Updates the question block views
	     */
	    this.init = function(oQuestionnaire) {
	    	this.oQuestionnaire = oQuestionnaire;
	    	this.iQuestionBlockCount = this.oQuestionnaire.questionBlocks.length;
	    }
	    
	    /**
	     * 
	     */
	    this.getQuestionnaire = function() {
	    	return this.oQuestionnaire;
	    }
	    
		/**
	     * 
	     */
	    this.addQuestionBlock = function() {
	    	this.iQuestionBlockCount++;
	    	oNewQb = {
    			_id: this.iQuestionBlockCount,
    			state: "new",
    			title: "Titel",
    			singleChoiceQuestions: [],
    			singleChoiceMatrixQuestions: [],
    			textQuestions: []
    		};
	    	this.oQuestionnaire.questionBlocks.push(oNewQb);
	    	return oNewQb;
	    };	
	    
		/**
	     * 
	     */
	    this.removeQuestionBlock = function(oQuestionBlock) {			
	    	this.oQuestionnaire.questionBlocks = jQuery.grep(this.oQuestionnaire.questionBlocks, function(value) {
	    		return value != oQuestionBlock;
    		});
	    };    
	    
		/**
	     * 
	     */
	    this.addSF = function() {			
	    	
	    };    
	    
		/**
	     * 
	     */
	    this.removeSF = function() {			
	    	
	    };    
	    
		/**
	     * 
	     */
	    this.addSMF = function() {			
	    	
	    };    
	    
		/**
	     * 
	     */
	    this.removeSMF = function() {			
	    	
	    };    
	    
		/**
	     * 
	     */
	    this.addTF = function() {			
	    	
	    };
	    
		/**
	     * 
	     */
	    this.removeTF = function() {			
	    	
	    };    
	    
		/**
	     * 
	     */
	    this.toJSON = function() {			
	    	
	    };
	}
})(jQuery);
